﻿using FluentNHibernate.Mapping;
using NHibernate.Type;
using Shake.Domain.Models;
using Shake.Domain.Emuns;

namespace Shake.Domain.Maps
{
    public class FlightTxMap : ClassMap<FlightTx>
    {
        public FlightTxMap()
        {
            this.Table("FLIGHTX");
            this.Id(t => t.Id).Column("FLIGHTX_ID").Length(32).Not.Nullable();
            this.Map(t => t.Number).Column("FLIGHTX_NO").Length(10).Not.Nullable();

            this.Map(t => t.FlightTime).Column("FLIGHTX_DATE").Not.Nullable();
            this.Map(t => t.DepartureTime).Column("STD").Not.Nullable();

            this.Map(t => t.IsValid).Column("VALID_FLG").Length(1).Default("Y").Not.Nullable().CustomType<YesNoType>();
            this.Map(t => t.Type).Column("FLIGHTX_TYPE").Length(1).Not.Nullable().CustomType<GenericEnumMapper<FlightTxType>>();
        }
    }
}